<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<form action="/add_book", method="post">

    {{ bookForm.csrf_token }}

    {{ bookForm.authorName.label }}
    {{ bookForm.authorName }}<br>

    {{ bookForm.bookName.label }}
    {{ bookForm.bookName }}<br>

    {{ bookForm.submit }}<br>

    {% for message in get_flashed_messages() %}
        <p style="color: red">{{ message }}</p>
    {% endfor %}


</form>
<hr>

<ul>
    {% for author in authors %}
        <li>作者: {{ author.name }}<a href="{{ url_for('delete_author',author_id=author.id)}}">删除</a> </li>
        <ul>
            {% for book in author.books %}
                <li>书籍: {{ book.name }} <a href="{{ url_for('delete_book',book_id=book.id) }}">删除</a> </li>
            {% endfor %}
        </ul>
    {% endfor %}


</ul>



</body>
</html>